home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / grep / grep < prev    next >
Text File  |  1994-08-27  |  3KB  |  64 lines

  1. e?grep version 1.3
  2. -rw-rw-r--  1 gray        79925 Sep 25 15:17 grep.lzh
  3.  
  4. GNU e?grep is based on a fast lazy-state deterministic matcher (about
  5. twice as fast as stock Unix egrep) hybridized with a Boyer-Moore-Gosper
  6. search for a fixed string that eliminates impossible text from being
  7. considered by the full regexp matcher without necessarily having to
  8. look at every character.  The result is typically many times faster
  9. than Unix grep or egrep.  (Regular expressions containing backreferencing
  10. may run more slowly, however.)
  11.  
  12. GNU e?grep attempts, as closely as possible, to understand compatibly
  13. the regexp syntaxes of the Unix programs it replaces.  The following table
  14. details the various special characters understood in both the grep and
  15. egrep incarnations:
  16.  
  17. (grep)    (egrep)        (explanation)
  18.   .       .        matches any single character except newline
  19.   \?       ?        postfix operator; preceeding item is optional
  20.   *       *        postfix operator; preceeding item 0 or more times
  21.   \+       +        postfix operator; preceeding item 1 or more times
  22.   \|       |        infix operator; matches either argument
  23.   ^       ^        matches the empty string at the beginning of a line
  24.   $       $        matches the empty string at the end of a line
  25.   \<       \<        matches the empty string at the beginning of a word
  26.   \>       \>        matches the empty string at the end of a word
  27.  [chars] [chars]    match any character in the given class; if the
  28.             first character after [ is ^, match any character
  29.             not in the given class; a range of characters may
  30.             be specified by <first>-<last>; for example, \W
  31.             (below) is equivalent to the class [^A-Za-z0-9]
  32.  \( \)      ( )        parentheses are used to override operator precedence
  33.  \<1-9>      \<1-9>    \<n> matches a repeat of the text matched earlier
  34.             in the regexp by the subexpression inside the
  35.             nth opening parenthesis
  36.   \       \        any special character may be preceded by a backslash
  37.             to match it literally
  38.  
  39. (the following are for compatibility with GNU Emacs)
  40.   \b       \b        matches the empty string at the edge of a word
  41.   \B       \B        matches the empty string if not at the edge of a word
  42.   \w       \w        matches word-constituent characters (letters & digits)
  43.   \W       \W        matches characters that are not word-constituent
  44.  
  45. Operator precedence is (highest to lowest) ?, *, and +, concatenation,
  46. and finally |.  All other constructs are syntactically identical to
  47. normal characters.  For the truly interested, a comment in dfa.c describes
  48. the exact grammar understood by the parser.
  49.  
  50. GNU e?grep understands the following command line options:
  51.     -A <num>    print <num> lines of context after every matching line
  52.     -B <num>    print <num> lines of context before every matching line
  53.     -C        print 2 lines of context on each side of every match
  54.     -<num>        print <num> lines of context on each side
  55.     -V        print the version number on stderr
  56.     -b        print every match preceded by its byte offset
  57.     -c        print a total count of matching lines only
  58.     -e <expr>    search for <expr>; useful if <expr> begins with -
  59.     -f <file>    take <expr> from the given <file>
  60.     -h        don't display filenames on matches
  61.     -i        ignore case difference when comparing strings
  62.     -l        list files containing matches only
  63.     -n        print each match preceded by its line number
  64.